package com.example.demo.generator.service.impl;

import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.example.demo.generator.entiy.DbUser;
import com.example.demo.generator.service.DbUserService;
import com.example.demo.generator.mapper.DbUserMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【db_user】的数据库操作Service实现
* @createDate 2022-07-29 09:13:06
*/
@Service
public class DbUserServiceImpl extends ServiceImpl<DbUserMapper, DbUser>
    implements DbUserService{

    @Override
    public R test(Integer pageNum, Integer pageSize) {
        PageInfo<DbUser> pageInfo = new PageInfo<>();
        if(pageNum!=null){
            if(pageSize!=null) {
                    PageHelper.startPage(pageNum, pageSize);
                    List<DbUser> dbUserList = this.list(null);
                    pageInfo = new PageInfo<>(dbUserList);
            }
        }else {
            List<DbUser>dbUserList = this.list(null);
            return R.ok(dbUserList);
        }
        return R.ok(pageInfo);
    }
}




